<link rel="stylesheet" href="https://file.viplgw.cn/ui/thinku-ielts-new/element-ui/index.css">
<link rel="stylesheet" href="/cn/css/mock/readDetail.css?v=1.1">
<script src="https://file.viplgw.cn/ui/public/js/jquery-3.2.1.min.js"></script>
<script src="https://file.viplgw.cn/ui/public/lib/vue/vue.js"></script>
<script src="https://file.viplgw.cn/ui/thinku-ielts-new/element-ui/index.js"></script>
<script src="https://file.viplgw.cn/ui/public/js/jquery.cookie.js"></script>

<section class="exerciseBox" id="readBox">
    <div class="guideTop">
        <div>
            <div class="guideTopLeft">
                <img class="logoLeft" src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/12@2x.png" alt="">
                <span>雅思机考<?php echo $public['type'] == 1 ? '听力' : ($public['type'] == 2 ? '阅读' : '全科') ?>
                    模拟卷<?php echo \YII::$app->params['noToStr'][$public['mockcate_id']] ?></span>
                <?php if ($public['type'] != 2) { ?>
                    <a :href="'/mock/detail.html?resultid='+resultid+'&subject=listen'">Listening</a>
                <?php }
                if ($public['type'] != 1) { ?>
                    <a href="javascript:;" class="on">Reading</a>
                <?php }
                if ($public['type'] == 5) { ?>
                    <a :href="'/mock/detail.html?resultid='+resultid+'&subject=write'">Writing</a>
                <?php } ?>
            </div>
            <a href="/mock.html"><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/11@2x.png" alt="">Quit</a>
        </div>
    </div>
    <div class="exerciseCenter" id="exerciseCenter">

        <!--第四步 做题-->
        <div class="steps step4" id="stepExercise" style="margin: 0 auto">
            <div class="quesBox" v-for="(itemBox,indexBox) in dataQuestion.data">
                <div class="partTitle" v-show="currentPart == indexBox ">
                    <p>Part {{indexBox + 1}} </p>
                    <span>Read the text below and answer questions {{dataQuestion.question_list[indexBox][0].th}} - {{dataQuestion.question_list[indexBox][dataQuestion.question_list[indexBox].length - 1].th}}.</span>
                </div>
                <div class="quesContent" v-show="currentPart == indexBox ">
                    <div class="articleText">
                        <div class="outDiv" v-for="(item,index) in itemBox.topic" :id="item.parent.type">
                            <!--单选题  numbering 7  是非判断题 numbering 3  都是单项选择题且表现形式一样-->
                            <div class="" v-if="item.parent.numbering == 7 || item.parent.numbering == 3">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="containerBox">
                                    <div class="singleBox ItemIn" v-for="(itemSon,indexSon) in item.son"
                                         :id="'read_'+ itemSon.content_id">
                                        <div class="singleTitle">
                                            <div v-html="itemSon.article"></div>
                                            <img class="spin"
                                                 src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/28@2x.png"
                                                 alt="" @click="toggle($event)">
                                        </div>
                                        <div class="singleZt">
                                            <div class="singleCover"
                                                 v-for="(itemSonDes,indexSonDes) in itemSon.description">
                                                <input :id="itemSon.id+'_'+indexSonDes" type="radio" class="radioBox"
                                                       @change="getAnswer(index,itemSon.id,indexSon)"
                                                       v-model="AnswerArry[indexBox][index][indexSon].answer"
                                                       :value="letterArry[indexSonDes]"
                                                       @click="getDoNow(itemSon.content_id)">
                                                <label :for="itemSon.id+'_'+indexSonDes"><b
                                                            style="margin-right: 5px;"></b>{{item.parent.numbering == 7 ? letterArry[indexSonDes] : ''}}
                                                    {{itemSonDes}}</label>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--多选题  1-->
                            <div class="" v-if="item.parent.numbering == 1">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="singleBox1 ItemIn" :id="'read_'+ item.son[0].content_id">
                                    <div class="singleTitle">
                                        <div v-html="item.son[0].article"></div>
                                        <img class="spin"
                                             src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/28@2x.png"
                                             alt="" @click="toggle($event)">
                                    </div>
                                    <div class="singleZt">
                                        <div class="singleCover"
                                             v-for="(itemSonDes,indexSonDes) in item.parent.sentenceNumber">
                                            <input :id="item.son[0].id+'_'+indexSonDes" type="checkbox" class="radioBox"
                                                   @change="getAnswer(index,item.son[0].id,indexSonDes,item.parent.answerCount)"
                                                   v-model="AnswerArry[indexBox][index][0].answer"
                                                   :value="letterArry[indexSonDes]"
                                                   @click="getDoNow(item.son[0].content_id)">
                                            <label :for="item.son[0].id+'_'+indexSonDes">
                                                <b style="margin-right: 5px;"></b>
                                                {{letterArry[indexSonDes]}}.<a v-html="itemSonDes"></a></label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--填空  除开单选和打勾题 全部算填空  首先是正常的填空-->
                            <div class="" v-if="item.parent.numbering == 2">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="quesArticle tableCover" v-html="item.parent.article"></div>
                            </div>
                            <!--heading 题型  大纲拖拽-->
                            <div class="" v-if="item.parent.numbering == 8">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="artiOption"
                                     v-for="(itemSentence,indexSentence) in item.parent.sentenceNumber">
                                    <p class="headSen">{{itemSentence}}</p>
                                </div>
                            </div>
                            <!--匹配 题型  打勾勾-->
                            <div class="" v-if="item.parent.numbering == 4">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="tickTable">
                                    <div class="tickItem">
                                        <p class="tickText"></p>
                                        <div class="chooseText"
                                             v-for="(chooseLetter,chooseIndex) in item.parent.article">{{chooseLetter}}
                                        </div>
                                    </div>
                                    <div class="tickItem" v-for="(itemSon,indexSon) in item.son">
                                        <p class="tickText">{{itemSon.article}}</p>
                                        <div class="chooseText tickCover"
                                             v-for="(itemSonDes,indexSonDes) in item.parent.article">
                                            <input :id="itemSon.id+'_'+indexSonDes" type="radio" class="radioBox"
                                                   @change="getAnswer(index,itemSon.id,indexSon)"
                                                   v-model="AnswerArry[indexBox][index][indexSon].answer"
                                                   :value="letterArry[indexSonDes]"
                                                   @click="getDoNow(itemSon.content_id)">
                                            <label :for="itemSon.id+'_'+indexSonDes"><span></span></label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--图片 题型-->
                            <div class="" v-if="item.parent.numbering == 5">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="quesCnName">
                                    <img :src="item.parent.image" alt="">
                                </div>
                                <div class="artiOption" v-for="(itemSon,indexSon) in item.son">
                                    <input type="text" :placeholder="itemSon.name" :id="'read_'+ itemSon.content_id"
                                           class="imgInput" v-model="AnswerArry[indexBox][index][indexSon].answer"
                                           @change="getAnswer(index,itemSon.id,indexSon)"
                                           @click="getDoNow(itemSon.content_id)">
                                </div>
                            </div>
                            <!--选项拖拽 题型-->
                            <div class="" v-if="item.parent.numbering == 6">
                                <div class="quesTitle">{{item.parent.title}}</div>
                                <div class="quesCnName" v-html="item.parent.cnName"></div>
                                <div class="quesCnName" v-html="item.parent.article"></div>
                                <div class="artiOption"
                                     v-for="(itemSentence,indexSentence) in item.parent.sentenceNumber">
                                    <p class="headSen">{{letterArry[indexSentence]}}. {{itemSentence}}</p>
                                </div>
                            </div>
                            <div class="answerBox">
                                <p class="answerBoxTitle">我的答案</p>
                                <div class="myAnswer">
                                    <span v-for="(itemSon,sonIndex) in item.son">
                                        {{itemSon.name}}. {{itemSon.my_answer != '' ? itemSon.my_answer : '--'}}
                                    </span>
                                </div>
                                <p class="answerBoxTitle">参考答案</p>
                                <div class="myAnswer">
                                    <span v-for="(itemSon,sonIndex) in item.son">
                                        {{itemSon.name}}. {{itemSon.answer}}
                                    </span>
                                </div>
                                <p class="answerBoxTitle">参考解析</p>
                                <div class="analysis">
                                    <div v-for="(itemSon,sonIndex) in item.son">
                                        {{itemSon.name}}. {{itemSon.analysis ? itemSon.analysis : '暂无解析'}}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="fullText">
                        <div class="original" v-html="itemBox.article.description"></div>
                        <div class="reportBox">
                            <p v-if="itemBox.isCollect != 1"
                               @click="collectPart(itemBox.article.content_id,2,itemBox.article.cate_id,indexBox)">
                                <img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/39@2x.png" alt="">
                                收藏题目
                            </p>
                            <p v-else @click="uncollectPart(itemBox.collectId,indexBox)">
                                <img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/41@2x.png" alt="">
                                取消收藏
                            </p>
                            <p @click="feedPart(itemBox.article.content_id)">
                                <img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/40@2x.png" alt="">
                                报错反馈
                            </p>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 底部按钮 -->
            <div class="footNav">
                <div class="footNavCover">
                    <div class="quesNumCover" id="quesNumCover">
                        <!-- quesNum 未做  fulfil已做  doNow 正在做 notSure 不确定review-->
                        <div class="zoning" v-for="(itemF,indexF) in dataQuestion.question_list">
                            <p>Part {{indexF + 1}}：</p>
                            <a href="javascript:void(0)"
                               :class="{'quesNum':index>-1, 'fulfil': item.isDo == 1, 'notSure': item.status == 1, 'doNow': item.th == current }"
                               v-for="(item,index) in itemF"
                               @click="welter(item.pid,item.content_id,item.th,item.status,indexF)">
                                {{item.th}}
                            </a>
                        </div>
                    </div>
                    <div class="turnBtn">
                        <a href="javascript:void(0)" class="prevBtn" @click="prev()">
                            <img :src="current>1?'https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/31@2x.png':'https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/34@2x.png'"
                                 alt="">
                        </a>
                        <a href="javascript:void(0)" class="nextBtn" @click="next()">
                            <img :src="current<totoleQues?'https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/35@2x.png':'https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/32@2x.png'"
                                 alt="">
                        </a>
                    </div>
                </div>
            </div>
            <!-- 举报反馈 -->
            <div class="feedBackBox" v-show="showFeed">
                <div class="feedBackCenter">
                    <img @click="showFeed=false" src="https://file.viplgw.cn/ui/thinku-ielts-new/images/mock/16@2x.png"
                         alt="">
                    <p>报错反馈</p>
                    <div class="singleZt feedBackZt">
                        <div class="singleCover">
                            <input id="cc_1" type="radio" class="radioBox" v-model="feedType" value="1">
                            <label for="cc_1"><b style="margin-right: 5px;"></b><b>题干有误</b></label>
                        </div>
                        <div class="singleCover">
                            <input id="cc_2" type="radio" class="radioBox" v-model="feedType" value="2">
                            <label for="cc_2"><b style="margin-right: 5px;"></b><b>答案有误</b></label>
                        </div>
                        <div class="singleCover">
                            <input id="cc_3" type="radio" class="radioBox" v-model="feedType" value="3">
                            <label for="cc_3"><b style="margin-right: 5px;"></b><b>格式有误</b></label>
                        </div>
                        <div class="singleCover">
                            <input id="cc_4" type="radio" class="radioBox" v-model="feedType" value="4">
                            <label for="cc_4"><b style="margin-right: 5px;"></b><b>解析有误</b></label>
                        </div>
                        <div class="singleCover">
                            <input id="cc_5" type="radio" class="radioBox" v-model="feedType" value="5">
                            <label for="cc_5"><b style="margin-right: 5px;"></b><b>其他问题</b></label>
                        </div>
                    </div>
                    <el-input type="textarea" style="width: 80%;margin:20px 10% 0 10%"
                              :autosize="{ minRows: 2, maxRows: 4}" placeholder="请简要描述你遇到的问题，帮助我们定位和解决（选填，200以内）"
                              v-model="feedBackContent">
                    </el-input>
                    <a href="javascript:;" @click="feedSub">提交</a>
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    window.readTest = new Vue({
        el: '#readBox',
        data() {
            return {
                userImage: '',
                userName: '',
                minutes: 60,
                seconds: 0,
                timeLayout: true,
                volume: 75,
                steps: 4,
                showTip: true,
                timeInter: null,
                isStart: false,

                letterArry: [], //序号  26个字母
                dataQuestion: {},//渲染数据
                resultid: '',//
                subject: '',//
                content_id: '',//当前整套题目content_id
                content_btn: '',//当前小题content_id 默认第一题的
                content_btn_status: '',//当前小题目 方形 圆形
                content_pid: '',//当前题目pid 默认第一题的
                totoleQues: 0,//总题目个数
                currentPart: 0,//当前显示的part
                current: 1,//当前正在看的题目序号
                AnswerArry: [],//答题数据
                showFeed: false,
                feedId: '',
                feedType: '',
                feedBackContent: '',
            }
        },
        watch: {},
        created() {
            let that = this;
            this.resultid = this.getQueryString('resultid')
            this.subject = this.getQueryString('subject')
            this.getData()
            for (let i = 65; i < 91; i++) {
                that.letterArry.push(String.fromCharCode(i));
            }
        },
        mounted() {

        },
        methods: {
            collectPart(content_id, typeid, catId, index) {
                let that = this;
                $.post('/cn/mock/collection', {
                    content_id: content_id,
                    typeid: typeid,
                    catId: catId,
                }, function (res) {
                    if (res.code == 1) {
                        that.dataQuestion.data[index].isCollect = 1
                        that.dataQuestion.data[index].collectId = res.data.id
                    } else {
                        alert(res.message)
                    }
                }, 'json')
            },
            uncollectPart(id, index) {
                let that = this;
                $.post('/cn/mock/delete-collection', {
                    id: id
                }, function (res) {
                    if (res.code == 1) {
                        that.dataQuestion.data[index].isCollect = 0
                    } else {
                        alert(res.message)
                    }
                }, 'json')
            },
            feedPart(id) {
                this.showFeed = true
                this.feedId = id
            },
            feedSub() {
                let that = this;
                $.post('/cn/mock/report', {
                    contentId: that.feedId,
                    reportType: that.feedType,
                    description: that.feedBackContent,
                    type: 2,
                }, function (res) {
                    if (res.code == 1) {
                        that.showFeed = false
                    } else {
                        alert(res.message)
                    }
                }, 'json')
            },
            getData() {
                let that = this;
                $.get('/cn/mock/detail-data', {
                    resultid: that.resultid,
                    subject: that.subject,
                }, function (res) {
                    if (res.code == 1) {
                        that.initData(res.data);
                        res.data.question_list.map((item, index) => {
                            that.totoleQues += item.length;
                        })
                    } else {
                        alert(res.message)
                    }
                }, 'json')
            },
            initData(data) {
                let that = this;
                that.dataQuestion = data;
                that.dataQuestion.data.map((item, itemIndex) => {
                    let arry = [];
                    that.AnswerArry.push(arry);
                    item.topic.map((train, index) => {
                        let arryson = []
                        that.AnswerArry[itemIndex].push(arryson);
                        //<!--多选题 numbering 1  填空题 numbering 2  判断题 numbering 3   打勾题 numbering 4   图片填空 numbering 5  选项拖拽题 numbering 6  单选 numbering 7  大纲拖拽题 numbering 8-->

                        if (train.parent.numbering == 4) { //打钩题
                            train.parent.article = train.parent.article.replace(/<\/?.+?>/g, "").replace(/ /g, "");
                        }
                        if (train.parent.numbering == 7 || train.parent.numbering == 3 || train.parent.numbering == 4) { //单选题  打勾题  是非判断 都看作单项选择题
                            train.son.map((trainSon, indexSon) => {
                                let obj = {};
                                obj.content_id = trainSon.content_id;
                                obj.answer = '';
                                obj.createTime = '';
                                obj.trueAnswer = trainSon.answer;
                                that.AnswerArry[itemIndex][index].push(obj);
                            });
                        } else if (train.parent.numbering == 1) { //多选选择题 1
                            train.son.map((trainSon, indexSon) => {
                                let obj = {};
                                obj.content_id = trainSon.content_id;
                                obj.answer = [];
                                obj.createTime = '';
                                obj.trueAnswer = trainSon.answer;
                                obj.answerCount = train.parent.answerCount;
                                that.AnswerArry[itemIndex][index].push(obj);
                            });
                        } else if (train.parent.numbering == 2) { //填空题 2
                            train.parent.article = train.parent.article.replace(/#&/g, '#&*');
                            train.parent.article = train.parent.article.split('*');

                            let last = train.parent.article[train.parent.article.length - 1];
                            train.parent.article = train.parent.article.slice(0, train.parent.article.length - 1);

                            for (var i in train.parent.article) {
                                train.parent.article[i] = train.parent.article[i].replace(/#&/g,
                                    "<input type='text' placeholder='" + train.son[i].name + "' class='BlankInput' id='read_" + train.son[i].content_id + "' data-part='" + itemIndex + "' data-topicNum='" + index + "' data-content-id='" + train.son[i].content_id +
                                    "' data-sonNum='" + i + "' onclick='window.readTest.getDoNow(" + train.son[i].content_id + ")'  oninput='window.readTest.blackBlur(this)'>")
                            }
                            let str = '';

                            for (var i in train.parent.article) {
                                str += train.parent.article[i];
                            }
                            train.parent.article = str + last;
                            train.son.map((trainSon, indexSon) => {
                                let obj = {};
                                obj.content_id = trainSon.content_id;
                                obj.answer = '';
                                obj.createTime = '';
                                obj.trueAnswer = trainSon.answer;
                                that.AnswerArry[itemIndex][index].push(obj);
                            });
                        } else if (train.parent.numbering == 8) { //除开单选多选打勾题 都按填空处理
                            train.parent.description = train.parent.description.replace(/#&/g, '#&^*');

                            train.parent.description = train.parent.description.split('^*');
                            let last = train.parent.description[train.parent.description.length - 1];
                            train.parent.description = train.parent.description.slice(0, train.parent.description.length - 1);
                            for (var i in train.parent.description) {
                                train.parent.description[i] = train.parent.description[i].replace(/#&/g,
                                    "<input type='text' placeholder='" + train.son[i].name + "' class='headInput' data-part='" + itemIndex + "' data-topicNum='" + index + "' data-content-id='" + train.son[i].content_id +
                                    "' data-sonNum='" + i + "' id='read_" + train.son[i].content_id + "' onclick='window.readTest.getDoNow(" + train.son[i].content_id + ")'  oninput='window.readTest.blackBlur(this)'>");
                            }
                            let str = '';
                            for (var i in train.parent.description) {
                                str += train.parent.description[i];
                            }
                            item.article.description = train.parent.description = str + (last != '' && last ? last : '');
                            train.son.map((trainSon, indexSon) => {
                                let obj = {};
                                obj.content_id = trainSon.content_id;
                                obj.answer = '';
                                obj.createTime = '';
                                obj.trueAnswer = trainSon.answer;
                                that.AnswerArry[itemIndex][index].push(obj);
                            });
                        } else if (train.parent.numbering == 5) {//图片填空
                            train.parent.image = 'https://ielts.thinkwithu.com' + train.parent.image;
                            train.son.map((trainSon, indexSon) => {
                                let obj = {};
                                obj.content_id = trainSon.content_id;
                                obj.answer = '';
                                obj.createTime = '';
                                obj.trueAnswer = trainSon.answer;
                                that.AnswerArry[itemIndex][index].push(obj);
                            });
                        } else if (train.parent.numbering == 6) {//选项拖拽
                            train.parent.article = train.parent.article.replace(/#&/g, '#&*');
                            train.parent.article = train.parent.article.split('*');
                            let articleEnd = $.trim(train.parent.article[train.parent.article.length - 1]);
                            train.parent.article = train.parent.article.slice(0, train.parent.article.length - 1);
                            for (var i in train.parent.article) {
                                train.parent.article[i] = train.parent.article[i].replace(/#&/g,
                                    "<input type='text' placeholder='" + train.son[i].name + "' class='headInput' data-part='" + itemIndex + "' data-topicNum='" + index + "' data-content-id='" + train.son[i].content_id +
                                    "' data-sonNum='" + i + "' id='read_" + train.son[i].content_id + "' onclick='window.readTest.getDoNow(" + train.son[i].content_id + ")'  oninput='window.readTest.blackBlur(this)'>");
                            }
                            let str = '';
                            for (var i in train.parent.article) {
                                str += train.parent.article[i];
                            }
                            let endCheck = articleEnd.replace(/<\/?.+?>/g, "").replace(/ /g, "");
                            if (endCheck && endCheck != '.') {
                                str += articleEnd;
                            }
                            train.parent.article = str;
                            train.son.map((trainSon, indexSon) => {
                                let obj = {};
                                obj.content_id = trainSon.content_id;
                                obj.answer = '';
                                obj.createTime = '';
                                obj.trueAnswer = trainSon.answer;
                                that.AnswerArry[itemIndex][index].push(obj);
                            });
                        }
                    })
                })
                if (this.getQueryString('content_id')) {
                    this.dataQuestion.question_list.map((itemF, indexF) => {
                        itemF.map((item, index) => {
                            if (item.content_id == this.getQueryString('content_id')) {
                                this.welter(item.pid, item.content_id, (10 * indexF + index + 1), item.status, indexF)
                            }
                        })
                    })
                }
                console.log(that.AnswerArry)
            },

            //展开折叠
            toggle(e) {
                if ($(e.target).hasClass('spinOut')) {
                    $(e.target).removeClass('spinOut');
                } else {
                    $(e.target).addClass('spinOut');
                }
                $(e.target).parents('.ItemIn').find('.singleZt').slideToggle();
            },
            //上一题
            prev() {
                let that = this;
                if (that.current > 1) {
                    that.current = that.current - 1;
                    that.dataQuestion.question_list.map((itemList, indexList) => {
                        itemList.map((item, index) => {
                            if (item.th == that.current) {
                                that.currentPart = indexList;
                                that.content_btn = item.content_id;
                                document.getElementById('read_' + that.content_btn).scrollIntoView({
                                    block: "center",
                                    behavior: "smooth"
                                })
                            }
                        })
                    })
                }
            },
            //下一题
            next() {
                let that = this;
                if (that.current < that.totoleQues) {
                    that.current = parseInt(that.current) + 1;
                    that.dataQuestion.question_list.map((itemList, indexList) => {
                        itemList.map((item, index) => {
                            if (item.th == that.current) {
                                that.currentPart = indexList;
                                that.content_btn = item.content_id;
                                document.getElementById('read_' + that.content_btn).scrollIntoView({
                                    block: "center",
                                    behavior: "smooth"
                                })
                            }
                        })
                    })
                }
            },
            //按钮点击滚动
            welter(pid, content_id, index, status, part) {
                this.currentPart = part;//当前正在看的篇幅
                this.current = index;//当前正在看的题目
                this.content_btn_status = status;//当前正在看的题目的状态  0方形 1 圆形
                this.content_btn = content_id;
                this.content_pid = pid;
                setTimeout(()=>{
                    document.getElementById('read_' + content_id).scrollIntoView({block: "center", behavior: "smooth"})
                },300)
            },
            //当前
            getDoNow(content_id) {
                let that = this;
                that.dataQuestion.question_list.map((itemList, indexList) => {
                    itemList.map((item, index) => {
                        if (item.content_id == content_id) {
                            that.current = item.th;
                            that.content_btn = content_id;
                        }
                    })
                })
            },
            //配对填空题  只算一题情况  模考里面展示按照多个题形式来展示
            blackMatch(obj) {
                let that = this;
                let str = '';
                $('.pairInput').each(function () {
                    if ($(this).val().replace(/\s*/g, "") == '') {
                        str += '*';
                    } else {
                        str += $(this).val();
                    }
                });
                let part = $(obj).attr('data-part');
                let site = $(obj).attr('data-topicNum');
                that.AnswerArry[part][site][0].answer = str;
                that.getAnswer();
            },
            //配对填空题  多题情况
            blackMatchMore(obj) {
                let that = this;
                let str = '';
                if ($(obj).val().replace(/\s*/g, "") == '') {
                    str = '*';
                } else {
                    str = $(obj).val();
                }
                let part = $(obj).attr('data-part');
                let site = $(obj).attr('data-topicNum');
                let siteDetail = $(obj).attr('data-sonNum');
                that.AnswerArry[part][site][siteDetail].answer = str;
                that.getAnswer();
            },
            //图片填空题
            blackBlur(obj) {
                let that = this;
                let part = $(obj).attr('data-part');
                let site = $(obj).attr('data-topicNum');
                let queIndex = $(obj).attr('data-sonNum');
                that.AnswerArry[part][site][queIndex].answer = $(obj).val();
                that.getAnswer();
            },
            //监听双向绑定的数据的变化 判断是否做了 多选判断length 单选填空判断去除空格为空
            getAnswer(site, id, index, answerCount) {
                let that = this;
                this.AnswerArry.map(itemPart => {
                    itemPart.map(item => {
                        item.map(itemSon => {
                            that.dataQuestion.question_list.map((list, index) => {
                                list.map(listItem => {
                                    if (typeof itemSon.answer == 'string') {
                                        if (listItem.content_id == itemSon.content_id && itemSon.answer.replace(/\s*/g, '') != '') {
                                            itemSon.createTime = Date.parse(new Date()).toString().substr(0, 10);
                                            listItem.isDo = 1;
                                        } else if (listItem.content_id == itemSon.content_id && itemSon.answer.replace(/\s*/g, '') == '') {
                                            listItem.isDo = 0;
                                        }
                                    } else {
                                        if (listItem.content_id == itemSon.content_id && itemSon.answer.length != 0) {
                                            itemSon.createTime = Date.parse(new Date()).toString().substr(0, 10);
                                            listItem.isDo = 1;
                                            if (itemSon.answerCount && (itemSon.answer.length > itemSon.answerCount)) {
                                                itemSon.answer = itemSon.answer.splice(itemSon.answer.length - answerCount, itemSon.answer.length)
                                            }
                                            itemSon.answer = itemSon.answer.sort()
                                        } else if (listItem.content_id == itemSon.content_id && itemSon.answer.length == 0) {
                                            listItem.isDo = 0;
                                        }
                                    }
                                })

                            })
                        })
                    })
                });
                console.log(that.AnswerArry);
            },
            getQueryString(name) {
                let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
                let r = window.location.search.substr(1).match(reg);
                if (r != null) {
                    return unescape(r[2]);
                }
                return null;
            },
        },
    })
</script>
